home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / layout / nsICSSLoader.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  6KB  |  148 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1999
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37. #ifndef nsICSSLoader_h___
  38. #define nsICSSLoader_h___
  39.  
  40. #include "nsISupports.h"
  41. #include "nsSubstring.h"
  42. #include "nsCompatibility.h"
  43.  
  44. class nsIAtom;
  45. class nsIURI;
  46. class nsICSSParser;
  47. class nsICSSStyleSheet;
  48. class nsPresContext;
  49. class nsIContent;
  50. class nsIParser;
  51. class nsIDocument;
  52. class nsIUnicharInputStream;
  53. class nsICSSLoaderObserver;
  54. class nsMediaList;
  55. class nsICSSImportRule;
  56.  
  57. // IID for the nsICSSLoader interface
  58. // 6c50f676-c764-4f2f-b62b-99d1076b44e9
  59. #define NS_ICSS_LOADER_IID     \
  60. {0x6c50f676, 0xc764, 0x4f2f, {0xb6, 0x2b, 0x99, 0xd1, 0x07, 0x6b, 0x44, 0xe9}}
  61.  
  62. typedef void (*nsCSSLoaderCallbackFunc)(nsICSSStyleSheet* aSheet, void *aData, PRBool aDidNotify);
  63.  
  64. class nsICSSLoader : public nsISupports {
  65. public:
  66.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICSS_LOADER_IID)
  67.  
  68.   NS_IMETHOD Init(nsIDocument* aDocument) = 0;
  69.   NS_IMETHOD DropDocumentReference(void) = 0; // notification that doc is going away
  70.  
  71.   NS_IMETHOD SetCaseSensitive(PRBool aCaseSensitive) = 0;
  72.   NS_IMETHOD SetCompatibilityMode(nsCompatibility aCompatMode) = 0;
  73.   NS_IMETHOD SetPreferredSheet(const nsAString& aTitle) = 0;
  74.   NS_IMETHOD GetPreferredSheet(nsAString& aTitle) = 0;
  75.  
  76.   // Get/Recycle a CSS parser for general use
  77.   NS_IMETHOD GetParserFor(nsICSSStyleSheet* aSheet,
  78.                           nsICSSParser** aParser) = 0;
  79.   NS_IMETHOD RecycleParser(nsICSSParser* aParser) = 0;
  80.  
  81.   // XXX No one uses the aDefaultNameSpaceID params.... do we need them?
  82.   
  83.   // Load an inline style sheet
  84.   // - if aCompleted is PR_TRUE, the sheet is fully loaded, don't
  85.   //   block for it.
  86.   // - if aCompleted is PR_FALSE, the sheet is still loading and 
  87.   //   will be marked complete when complete
  88.   NS_IMETHOD LoadInlineStyle(nsIContent* aElement,
  89.                              nsIUnicharInputStream* aStream, 
  90.                              PRUint32 aLineNumber,
  91.                              const nsSubstring& aTitle, 
  92.                              const nsSubstring& aMedia, 
  93.                              nsIParser* aParserToUnblock,
  94.                              PRBool& aCompleted,
  95.                              nsICSSLoaderObserver* aObserver) = 0;
  96.  
  97.   // Load a linked style sheet
  98.   // - if aCompleted is PR_TRUE, the sheet is fully loaded, don't
  99.   //   block for it.
  100.   // - if aCompleted is PR_FALSE, the sheet is still loading and 
  101.   //   will be marked complete when complete
  102.   NS_IMETHOD LoadStyleLink(nsIContent* aElement,
  103.                            nsIURI* aURL, 
  104.                            const nsSubstring& aTitle, 
  105.                            const nsSubstring& aMedia, 
  106.                            nsIParser* aParserToUnblock,
  107.                            PRBool& aCompleted,
  108.                            nsICSSLoaderObserver* aObserver) = 0;
  109.  
  110.   // Load a child style sheet (@import)
  111.   NS_IMETHOD LoadChildSheet(nsICSSStyleSheet* aParentSheet,
  112.                             nsIURI* aURL, 
  113.                             nsMediaList* aMedia,
  114.                             nsICSSImportRule* aRule) = 0;
  115.  
  116.   // Load a user agent or user sheet.  The sheet is loaded
  117.   // synchronously, including @imports from it.
  118.   NS_IMETHOD LoadAgentSheet(nsIURI* aURL, nsICSSStyleSheet** aSheet) = 0;
  119.  
  120.   // Load a user agent or user sheet.  The sheet is loaded
  121.   // asynchronously and the observer notified when the load finishes.
  122.   NS_IMETHOD LoadAgentSheet(nsIURI* aURL, nsICSSLoaderObserver* aObserver) = 0;
  123.  
  124.   // stop loading all sheets
  125.   NS_IMETHOD Stop(void) = 0;
  126.  
  127.   // stop loading one sheet
  128.   NS_IMETHOD StopLoadingSheet(nsIURI* aURL) = 0;
  129.  
  130.   /**
  131.    * Whether the loader is enabled or not.
  132.    * When disabled, processing of new styles is disabled and an attempt
  133.    * to do so will fail with a return code of
  134.    * NS_ERROR_NOT_AVAILABLE. Note that this DOES NOT disable
  135.    * currently loading styles or already processed styles.
  136.    */
  137.   NS_IMETHOD GetEnabled(PRBool *aEnabled) = 0;
  138.   NS_IMETHOD SetEnabled(PRBool aEnabled) = 0;
  139. };
  140.  
  141. nsresult 
  142. NS_NewCSSLoader(nsIDocument* aDocument, nsICSSLoader** aLoader);
  143.  
  144. nsresult 
  145. NS_NewCSSLoader(nsICSSLoader** aLoader);
  146.  
  147. #endif /* nsICSSLoader_h___ */
  148.